﻿'use strict'
let fs = require('fs');
let http = require('http');
let https = require('https');
let url = require('url');

let options = {
    pfx: fs.readFileSync('bitshe.cn.pfx'),
    passphrase: '130.DF52'
};

https.createServer(options, (req, res) => {
    let url = '.' + ('/' === req.url ? '/index.html' : req.url);
    fs.readFile(url, (err, data) => {
        if (err) {
            res.writeHead(404, { 'Content-Type': 'text/html' });
            res.end('404 not found');
        }
        //res.writeHead(200, { 'Content-Type': 'text/html' });
        res.end(data);
    });
}).listen(443);

console.log('服务器已经运行！\n现在访问https://bitshe.cn');